package hn.sigit.model.hnd.cadastre;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.UniqueConstraint;

@Embeddable
public class HND_PermitNorm {
	private Integer maxNumberOfFloors;
	private BigDecimal maxBuildingArea;
	private List<HND_BuildingMaterial> forbiddenBuildingMaterials = new ArrayList<HND_BuildingMaterial>();
	
	
	@Column(name="MaxNumberOfFloors", nullable=true)
	public Integer getMaxNumberOfFloors() {
		return maxNumberOfFloors;
	}
	public void setMaxNumberOfFloors(Integer maxNumberOfFloors) {
		this.maxNumberOfFloors = maxNumberOfFloors;
	}
	
	@Column(name="MaxBuildingArea", nullable=true, precision=24, scale=8)
	public BigDecimal getMaxBuildingArea() {
		return maxBuildingArea;
	}
	public void setMaxBuildingArea(BigDecimal maxBuildingArea) {
		this.maxBuildingArea = maxBuildingArea;
	}
	
	@ManyToMany(targetEntity=HND_BuildingMaterial.class)
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)
	@JoinTable(name="HND_SpatialZoneForbiddenBuildingMaterials", schema="hnd_administrative",
			joinColumns={ @JoinColumn(name="HND_SpatialZoneID") }, inverseJoinColumns={ @JoinColumn(name="HND_BuildingMaterialID") },
			uniqueConstraints={ @UniqueConstraint(columnNames={"HND_SpatialZoneID", "HND_BuildingMaterialID"}) })
	public List<HND_BuildingMaterial> getForbiddenBuildingMaterials() {
		return forbiddenBuildingMaterials;
	}
	public void setForbiddenBuildingMaterials(
			List<HND_BuildingMaterial> forbiddenBuildingMaterials) {
		this.forbiddenBuildingMaterials = forbiddenBuildingMaterials;
	}
	
}
